<template>
  <div :class="['logo']" @click="toHome">
    <img :src="logo" alt=""/>
    <span v-if="!collapse" class="logo-title">{{ baseTitle }}</span>
  </div>
</template>

<script lang="ts" setup>
import logo from '@/assets/images/logo.png';
import { useRouter } from 'vue-router';

const baseTitle = import.meta.env.VITE_APP_TITLE
defineProps({
  collapse: Boolean,
});

const router = useRouter();

const toHome = () => {
  router.push({path: '/'});
};
</script>

<style lang="scss" scoped>
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  background-color: var(--el-menu-bg-color);
  cursor: pointer;

  img {
    display: inline-block;
    height: 32px;
    vertical-align: middle;
  }

  .logo-title {
    display: inline-block;
    margin: 0 0 0 12px;
    font-weight: 600;
    line-height: 50px;
    font-size: 14px;
    vertical-align: middle;
    color: var(--el-text-color-primary);
  }
}
</style>
